<?php

class Default_EcurieController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
    	$ecurieDAO = new Application_Model_EcurieDAO();
        $this->view->ecuries = $ecurieDAO->findAll();
    }
	
    public function showAction()
    {
    	$id = $this->getRequest()->getParam('id');
    	$ecurieDAO = new Application_Model_EcurieDAO();
    	$piloteDAO = new Application_Model_PiloteDAO();
    	$voitureDAO = new Application_Model_VoitureDAO();
    	$this->view->id =$id;
    	$this->view->ecuries = $ecurieDAO->findAll();
    	$this->view->ecurie = $ecurieDAO->find((int)$id);
    	$this->view->pilotes = $piloteDAO->findByEcurie($id);
    	$this->view->voitures = $voitureDAO->findByEcurie($id);
    }
}

